package com.umeox.watch.moto.dataservice.db.model;

import androidx.annotation.NonNull;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

/**
 * Created by Rambo 2024/5/28/0028
 * Describe: 群成员表
 */
@Entity(tableName = IMGroupMember.TABLE_NAME)
public class IMGroupMember {
    @Ignore
    public static final String TABLE_NAME = "im_group_member";
    @PrimaryKey(autoGenerate = true)
    public long _id;
    @NonNull
    private String memberId = ""; //用户id
    private String groupId; //所属群的ID
    private int type;//0：群主；1：管理员；2：普通成员；
    private String name;//昵称
    private String avatar;//头像
    private int avatarIndex;//固定头像的下标
    private int createTime;//加入时间 秒

    public String getMemberId() {
        return memberId;
    }

    public void setMemberId(String memberId) {
        this.memberId = memberId;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public int getAvatarIndex() {
        return avatarIndex;
    }

    public void setAvatarIndex(int avatarIndex) {
        this.avatarIndex = avatarIndex;
    }

    public int getCreateTime() {
        return createTime;
    }

    public void setCreateTime(int createTime) {
        this.createTime = createTime;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof IMGroupMember)) return false;

        IMGroupMember imGroupMember = (IMGroupMember) o;

        return memberId.equals(imGroupMember.memberId) && groupId.equals(imGroupMember.groupId);
    }

    @Override
    public int hashCode() {
        return String.valueOf(memberId).hashCode();
    }

    @Override
    public String toString() {
        return "IMGroupMember{" +
                "memberId=" + memberId +
                ", groupId=" + groupId +
                ", type=" + type +
                ", name='" + name + '\'' +
                ", avatar='" + avatar + '\'' +
                ", avatarIndex=" + avatarIndex +
                ", createTime=" + createTime +
                '}';
    }
}
